package com.xiaoyu.tool.controller.admin;

import com.xiaoyu.tool.service.user.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *首页
 * */
@Controller
@RequestMapping("/admin")
public class AdminWelcomeController {

    private final UserService userService;

    public AdminWelcomeController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/welcome")
    public String welcome(Model model){
        model.addAttribute("userCount",userService.countTotalUsers());
        return "admin/index";
    }

}
